package com.example.viewpagerandlistview;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import android.os.Bundle;

import com.example.viewpagerandlistview.adapter.ViewPagerAdapter;
import com.example.viewpagerandlistview.fragment.Fragment1;
import com.example.viewpagerandlistview.fragment.Fragment2;
import com.example.viewpagerandlistview.fragment.Fragment3;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private ViewPager viewPager;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initDate();
        initEvent();
    }

    private void initView() {
        viewPager = findViewById(R.id.viewpager);
        List<Fragment> fragmentList = new ArrayList<>();
        Fragment1 fragment1 = new Fragment1();
        Fragment2 fragment2 = new Fragment2();
        Fragment3 fragment3 = new Fragment3();
        fragmentList.add(fragment1);
        fragmentList.add(fragment2);
        fragmentList.add(fragment3);
        viewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(),fragmentList));
    }

    private void initDate() {
    }

    private void initEvent() {
    }
}